<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('新增用户')"/>
    <style>
        label.error{
         /*left:610px!important;;*/
        }
 </style>

</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
    <form class="form-horizontal m" id="form-add">
        <h3 class="m-t-none m-b " style="text-align:center"> 你在使用什么语言工作啊</h3>
        <div class="form-group">
            <label class="col-sm-3 control-label is-required">工作语言（可以多选）：</label>
            <div class="col-sm-8">
                <label class="check-box">
                    <input type="checkbox" value="1" id="inlineCheckbox1" name="lan">C</label>
                <label class="check-box">
                    <input type="checkbox" value="2" id="inlineCheckbox2" name="lan">java</label>
                <label class="check-box">
                    <input type="checkbox" value="3" id="inlineCheckbox3" name="lan">python</label>
                <label class="check-box">
                    <input type="checkbox" value="4" id="inlineCheckbox4" name="lan">c++</label>
                <label class="check-box">
                    <input type="checkbox" value="5" id="inlineCheckbox5" name="lan">c#</label>
                <label class="check-box">
                    <input type="checkbox" value="6" id="inlineCheckbox6" name="lan">Visual Basic</label>
                <label class="check-box">
                    <input type="checkbox" value="7" id="inlineCheckbox7" name="lan">javascript</label>
                <label class="check-box">
                    <input type="checkbox" value="8" id="inlineCheckbox8" name="lan">PHP</label>
            </div>
        </div>
        <div class="form-group" style="text-align:center;margin-top:30px">
            <button class="btn btn-primary " type="button" id="btnSubmit"><i class="fa fa-check"></i>&nbsp;提交</button>
        </div>
    </form>
</div>
<th:block th:include="include :: footer"/>

<script type="text/javascript">
		var prefix = ctx + "anti/vote";

		$("#form-add").validate({
			onkeyup: false,
			rules:{
				lan:{
					required:true
				}
			},
		    focusCleanup: true,
		    errorPlacement : function(error, element) {
		        error.appendTo(element.parent().parent().parent().children(".check-box:last-child"));
		    }
		});

		function submitHandler() {
	        if ($.validate.form()) {
	        	$.operate.save(prefix + "/add", $('#form-add').serialize(),function(){
                    window.location.href= prefix + "/table";
	        	});
	        }
	    }
	    $("#btnSubmit").click(function(){
	    submitHandler();
	    });

</script>
</body>
</html>
